package com.nineclock.document.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.document.pojo.DocFile;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DocFileMapper extends BaseMapper<DocFile> {

    /**
     * 根据当员工ID,查询能够操作的写作者文件
     * @param companyUserId
     * @param parentFolderId
     * @return
     */
    @Select("select * from doc_file where id in " +
            "(select file_id " +
            "from " +
            "doc_collaborations " +
            "where " +
            "collaboration_id = #{companyUserId}) " +
            "and folder_id = #{parentFolderId} and status = 1")

    public List<DocFile> queryFileListByCollaboration(@Param("companyUserId") Long companyUserId, @Param("parentFolderId")  Long parentFolderId);
}
